package com.briup.sxau.web.controller;

import com.briup.sxau.bean.User;
import com.briup.sxau.service.IUserService;
import com.briup.sxau.util.Result;
import com.briup.sxau.util.SxauException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
@Api(tags = "用户管理相关接口")
public class UserController {
    @Autowired
    IUserService userService;

    @PostMapping("login")
    @ApiOperation("用户登录接口，json数据格式 必须要有password和username两个字段")
    public Result login(@RequestBody User user) {

        String s = userService.login(user.getUsername(), user.getPassword());
        return Result.success(s);

    }

}
